<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>岗位发布申请表</title>
    <link rel="stylesheet" href="../../../dist/css/layui.css">

</head>
<body>
<form class="layui-form">

    <!-- 岗位名称 -->
    <div class="layui-form-item" style="width: 300px">
        <label class="layui-form-label">岗位名称:</label>
        <div class="layui-input-block">
            <input type="text" name="jobName" required placeholder="请输入岗位名称" autocomplete="off" class="layui-input">
        </div>
    </div>

    <!-- 岗位工作区 -->
    <div class="layui-form-item">
        <label class="layui-form-label">工作区:</label>
        <div class="layui-input-block">
            <select name="jobCategory" lay-verify="required">
                <option value=""></option>
                <option value="1">教学区</option>
                <option value="2">行政区</option>
                <option value="3">图书馆</option>
                <option value="4">教务</option>
                <option value="5">后勤</option>
            </select>
        </div>
    </div>

    <!-- 岗位工作地点 -->
    <div class="layui-form-item">
        <label class="layui-form-label">工作地点:</label>
        <div class="layui-input-inline">
            <input type="text" name="place" placeholder="请输入工作地点" autocomplete="off" class="layui-input">
        </div>
    </div>

    <!-- 工作详情描述 -->
    <div class="layui-form-item">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">工作详情:</label>
            <div class="layui-input-block">
                <textarea name="workDetail" placeholder="请输入工作详情" class="layui-textarea" lay-verify="required"></textarea>
            </div>
        </div>
    </div>

    <!-- 用工人数 -->
    <div class="layui-form-item">
        <label class="layui-form-label">用工人数:</label>
        <div class="layui-input-inline">
            <input type="text" name="needCount" lay-verify="required" placeholder="请输入用工人数" autocomplete="off" class="layui-input">
        </div>
    </div>

    <!-- 所在学年 -->
    <div class="layui-form-item">
        <label class="layui-form-label">所在学年:</label>
        <div class="layui-input-block">
            <select name="year" lay-verify="required">
                <option value=""></option>
                <option value="2022">2022</option>
                <option value="2023">2023</option>
            </select>
        </div>
    </div>

    <!-- 所在学期 -->
    <div class="layui-form-item">
        <label class="layui-form-label">所在学期:</label>
        <div class="layui-input-block">
            <select name="term" lay-verify="required">
                <option value=""></option>
                <option value="1">秋季学期</option>
                <option value="2">夏季学期</option>
            </select>
        </div>
    </div>

    <!-- 提交 -->
    <div style="margin-top: 30px">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal layui-block" lay-submit hidden="">提交</button>
        </div>
    </div>

</form>

<script src="../../../dist/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form
            ,$ = layui.jquery;

        form.on('submit()',function(data){

            $.ajax({
                url:'/dept/insertDeptAddJobApplication',
                async: false,
                type:'post',
                data:data.field,
                // 是否使用传统的方式浅层序列化,若有数组参数或对象参数需要设置true
                traditional: true,
                dataType:'JSON',
                success:function(result){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    // 关闭父级弹出层
                    parent.layer.close(index);
                    parent.parent.layer.msg("申请成功！请等待审批",{icon:1,time:1000});
                    // 刷新父页面
                    parent.location.reload();

                }
            });
            return false;//组织表单默认提交并跳转
        });

    });
</script>
</body>
</html>
